FROM {{ namespace }}/{{ image_prefix }}openstack-base:{{ tag }}
{% block labels %}
LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build_date }}"
{% endblock %}

{% block masakari_base_header %}{% endblock %}

{% import "macros.j2" as macros with context %}

{{ macros.configure_user(name='masakari') }}

{% if base_package_type == 'rpm' %}

    {% set masakari_base_packages = [
    ] %}

{% elif base_package_type == 'deb' %}

    {% set masakari_base_packages = [
    ] %}

{% endif %}

{{ macros.install_packages(masakari_base_packages | customizable("packages")) }}

ADD masakari-base-archive /masakari-base-source

{% set masakari_base_pip_packages = [
    '/masakari'
] %}

COPY extend_start.sh /usr/local/bin/kolla_extend_start

RUN ln -s masakari-base-source/* masakari \
    && {{ macros.install_pip(masakari_base_pip_packages | customizable("pip_packages")) }} \
    && mkdir -p /etc/masakari /var/www/cgi-bin/masakari \
    && cp -r /masakari/etc/masakari/* /etc/masakari/ \
    && chmod 755 /var/www/cgi-bin/masakari \
    && touch /usr/local/bin/kolla_masakari_extend_start \
    && chmod 644 /usr/local/bin/kolla_extend_start /usr/local/bin/kolla_masakari_extend_start

{{ macros.kolla_patch_sources() }}

{% block masakari_base_footer %}{% endblock %}
